home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group01b.txt / 000071_icon-group-sender_Wed Jun 6 16:37:20 2001.msg < prev    next >
Internet Message Format  |  2002-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id f56NawM23962
  4.     for icon-group-addresses; Wed, 6 Jun 2001 16:36:58 -0700 (MST)
  5. Message-Id: <200106062336.f56NawM23962@baskerville.CS.Arizona.EDU>
  6. From: "John Sampson" <jsampson@indexes.u-net.com>
  7. To: <icon-group@cs.arizona.edu>
  8. Subject: Re: [Icon-Group] Funny result with strings
  9. Date: Wed, 6 Jun 2001 22:54:23 +0100
  10. X-Priority: 3
  11. X-MSMail-Priority: Normal
  12. X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
  13. Errors-To: icon-group-errors@cs.arizona.edu
  14. Status: RO
  15. Content-Length: 1431
  16.  
  17. Hello -
  18.  
  19. Thanks for the advice.
  20.  
  21. Further to my previous, I tried passing a string to Steve Hunter's procedure
  22. in the same way as I was passing it to 'split' in my original program (see
  23. code below). Here I have used '$' as the delimiter, and changed the
  24. procedure code accordingly. It works. Putting the French colon '|' back
  25. instead of '$', I find that the same thing happens with 'tug' as with
  26. 'split'. The problem, as suggested, must lie with DOS rather than Icon - it
  27. arises when the string is read from standard input, i.e. from the DOS prompt
  28. from Windows 95. DOS sabotages French colons. In that case I assume it won't
  29. matter how making a list is done in Icon - the same problem will arise. The
  30. only cure is to change the delimiter or change the operating system.
  31.  
  32. Regards
  33.  
  34. _John Sampson_
  35.  
  36.  
  37.  
  38. #------------------
  39.  
  40. procedure main()
  41.  s := read()
  42.  fr_colon(s)
  43. end
  44.  
  45. procedure fr_colon(arg_l)
  46. local l
  47.  
  48. arg_l ? every put(l:=[], tug(~'$')) # Steve Hunter's calling procedure
  49. changed
  50.  
  51. \/write(!l)
  52. end
  53.  
  54.  
  55. #`tug' stands for: tab(upto()) and generate-cs-spans.
  56. # On exhaustion, |&pos| is restored to the on-call value, but, this
  57. # still doesn't
  58. # qualify as a true matching-expression, because |tug|() doesn't return
  59. # the entire
  60. # contiguous span between the on-entry |&pos| and (each) post-eval
  61. # |&pos|.
  62.  
  63. procedure tug(cs) # Written by Steve Hunter
  64. local Li
  65. cs := cset(cs)
  66. suspend tab(|(upto(cs,,Li)\1)) & tab(Li := many(cs))
  67. end
  68.  
  69.  
  70.  
  71.  
  72.